.class public Lcom/instagram/creation/video/h/d;
.super Lcom/instagram/creation/video/h/a;
.source "FinalRenderControllerICS.java"

# interfaces
.implements Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;
.implements Landroid/media/MediaPlayer$OnCompletionListener;
.implements Landroid/media/MediaPlayer$OnSeekCompleteListener;


# annotations
.annotation build Landroid/annotation/TargetApi;
    value = 0xe
.end annotation


# instance fields
.field private A:I

.field private final B:Ljava/lang/Object;

.field private C:Z

.field private final b:Ljava/lang/String;

.field private final c:Lcom/instagram/pendingmedia/model/c;

.field private d:Landroid/media/MediaPlayer;

.field private e:I

.field private f:Ljava/util/Queue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Queue",
            "<",
            "Lcom/instagram/creation/video/gl/k;",
            ">;"
        }
    .end annotation
.end field

.field private g:Ljava/util/Queue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Queue",
            "<",
            "Ljava/lang/Integer;",
            ">;"
        }
    .end annotation
.end field

.field private h:Ljava/util/Queue;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Queue",
            "<",
            "Ljava/lang/Integer;",
            ">;"
        }
    .end annotation
.end field

.field private i:Lcom/instagram/creation/video/h/i;

.field private j:Lcom/instagram/creation/video/h/g;

.field private k:Lcom/instagram/creation/video/h/b;

.field private volatile l:Z

.field private volatile m:Z

.field private volatile n:I

.field private volatile o:I

.field private p:Lcom/instagram/creation/video/gl/k;

.field private final q:Ljava/lang/Object;

.field private r:Z

.field private s:Z

.field private t:I

.field private final u:Ljava/lang/Object;

.field private v:Z

.field private w:Ljava/util/Iterator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Iterator",
            "<",
            "Ljava/nio/ByteBuffer;",
            ">;"
        }
    .end annotation
.end field

.field private x:Ljava/util/Iterator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Iterator",
            "<",
            "Ljava/lang/Long;",
            ">;"
        }
    .end annotation
.end field

.field private y:J

.field private z:Lcom/instagram/pendingmedia/model/a;


# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/instagram/pendingmedia/model/c;Lcom/instagram/creation/video/e/p;)V
    .locals 7
    .parameter
    .parameter
    .parameter

    .prologue
    const/4 v6, 0x2

    const/4 v5, 0x1

    const/4 v4, 0x0

    .line 90
    new-instance v0, Lcom/instagram/creation/video/gl/l;

    const/4 v1, 0x0

    const/16 v2, 0x1e0

    invoke-direct {v0, v1, v2}, Lcom/instagram/creation/video/gl/l;-><init>(Landroid/graphics/SurfaceTexture;I)V

    invoke-direct {p0, v0}, Lcom/instagram/creation/video/h/a;-><init>(Lcom/instagram/creation/video/gl/l;)V

    .line 54
    iput v4, p0, Lcom/instagram/creation/video/h/d;->e:I

    .line 68
    const/4 v0, -0x1

    iput v0, p0, Lcom/instagram/creation/video/h/d;->o:I

    .line 71
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->q:Ljava/lang/Object;

    .line 75
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->u:Ljava/lang/Object;

    .line 80
    const-wide v0, 0x7fffffffffffffffL

    iput-wide v0, p0, Lcom/instagram/creation/video/h/d;->y:J

    .line 85
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->B:Ljava/lang/Object;

    .line 92
    invoke-virtual {p2}, Lcom/instagram/pendingmedia/model/c;->H()Lcom/instagram/pendingmedia/model/a;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    .line 94
    const-string v0, "FinalRenderControllerICS"

    const-string v1, "Rendering file %s using filter %s"

    new-array v2, v6, [Ljava/lang/Object;

    iget-object v3, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v3}, Lcom/instagram/pendingmedia/model/a;->b()Ljava/lang/String;

    move-result-object v3

    aput-object v3, v2, v4

    invoke-virtual {p2}, Lcom/instagram/pendingmedia/model/c;->e()I

    move-result v3

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    aput-object v3, v2, v5

    invoke-static {v1, v2}, Lcom/facebook/c/i/c;->a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 100
    new-instance v0, Lcom/instagram/creation/video/h/g;

    invoke-direct {v0, v5}, Lcom/instagram/creation/video/h/g;-><init>(I)V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    .line 101
    new-instance v0, Lcom/instagram/creation/video/h/b;

    invoke-direct {v0, p3}, Lcom/instagram/creation/video/h/b;-><init>(Lcom/instagram/creation/video/e/p;)V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->k:Lcom/instagram/creation/video/h/b;

    .line 102
    new-instance v0, Lcom/instagram/creation/video/h/i;

    new-array v1, v6, [Lcom/instagram/creation/video/gl/a;

    iget-object v2, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    aput-object v2, v1, v4

    iget-object v2, p0, Lcom/instagram/creation/video/h/d;->k:Lcom/instagram/creation/video/h/b;

    aput-object v2, v1, v5

    invoke-direct {v0, v1}, Lcom/instagram/creation/video/h/i;-><init>([Lcom/instagram/creation/video/gl/a;)V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    .line 103
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v0

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/a;)V

    .line 105
    iput-object p2, p0, Lcom/instagram/creation/video/h/d;->c:Lcom/instagram/pendingmedia/model/c;

    .line 107
    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->f:Ljava/util/Queue;

    .line 109
    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->g:Ljava/util/Queue;

    .line 110
    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->h:Ljava/util/Queue;

    .line 112
    invoke-static {p1}, Lcom/instagram/creation/video/j/k;->a(Landroid/content/Context;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->b:Ljava/lang/String;

    .line 113
    return-void
.end method

.method private a(J)V
    .locals 6
    .parameter

    .prologue
    .line 257
    :goto_0
    iget-wide v0, p0, Lcom/instagram/creation/video/h/d;->y:J

    cmp-long v0, v0, p1

    if-gez v0, :cond_0

    .line 258
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->w:Ljava/util/Iterator;

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/nio/ByteBuffer;

    .line 259
    invoke-virtual {v0}, Ljava/nio/ByteBuffer;->limit()I

    move-result v1

    iget-wide v2, p0, Lcom/instagram/creation/video/h/d;->y:J

    iget v4, p0, Lcom/instagram/creation/video/h/d;->A:I

    int-to-long v4, v4

    sub-long/2addr v2, v4

    invoke-static {v0, v1, v2, v3}, Lcom/instagram/creation/video/jni/VideoBridge;->writeAudioPacket(Ljava/nio/ByteBuffer;IJ)I

    .line 260
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->x:Ljava/util/Iterator;

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Long;

    invoke-virtual {v0}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    iput-wide v0, p0, Lcom/instagram/creation/video/h/d;->y:J

    goto :goto_0

    .line 262
    :cond_0
    return-void
.end method

.method private t()V
    .locals 14

    .prologue
    .line 328
    new-instance v5, Ljava/util/LinkedList;

    invoke-direct {v5}, Ljava/util/LinkedList;-><init>()V

    .line 330
    :try_start_0
    new-instance v0, Ljava/io/FileInputStream;

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v1}, Lcom/instagram/pendingmedia/model/a;->b()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/FileInputStream;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/FileInputStream;->getChannel()Ljava/nio/channels/FileChannel;

    move-result-object v0

    .line 331
    invoke-static {v0}, Lcom/googlecode/mp4parser/a/b/a/a;->a(Ljava/nio/channels/ReadableByteChannel;)Lcom/googlecode/mp4parser/a/c;

    move-result-object v0

    .line 332
    invoke-virtual {v0}, Lcom/googlecode/mp4parser/a/c;->a()Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v6

    :cond_0
    :goto_0
    invoke-interface {v6}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3

    invoke-interface {v6}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/googlecode/mp4parser/a/e;

    .line 333
    invoke-interface {v0}, Lcom/googlecode/mp4parser/a/e;->l()Ljava/lang/String;

    move-result-object v1

    const-string v2, "soun"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 334
    const-wide v1, 0x412e848000000000L

    invoke-interface {v0}, Lcom/googlecode/mp4parser/a/e;->k()Lcom/googlecode/mp4parser/a/f;

    move-result-object v3

    invoke-virtual {v3}, Lcom/googlecode/mp4parser/a/f;->b()J

    move-result-wide v3

    long-to-double v3, v3

    div-double v7, v1, v3

    .line 336
    invoke-interface {v0}, Lcom/googlecode/mp4parser/a/e;->g()Ljava/util/List;

    move-result-object v1

    invoke-interface {v1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v9

    .line 337
    const-wide/16 v3, 0x0

    .line 338
    :cond_1
    invoke-interface {v9}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_2

    .line 339
    invoke-interface {v9}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/coremedia/iso/boxes/k;

    .line 340
    const/4 v2, 0x0

    :goto_1
    int-to-long v10, v2

    invoke-virtual {v1}, Lcom/coremedia/iso/boxes/k;->a()J

    move-result-wide v12

    cmp-long v10, v10, v12

    if-gez v10, :cond_1

    .line 341
    long-to-double v10, v3

    mul-double/2addr v10, v7

    double-to-long v10, v10

    invoke-static {v10, v11}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v10

    invoke-interface {v5, v10}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 342
    invoke-virtual {v1}, Lcom/coremedia/iso/boxes/k;->b()J

    move-result-wide v10

    add-long/2addr v3, v10

    .line 340
    add-int/lit8 v2, v2, 0x1

    goto :goto_1

    .line 346
    :cond_2
    invoke-interface {v0}, Lcom/googlecode/mp4parser/a/e;->e()Ljava/util/List;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->w:Ljava/util/Iterator;

    .line 348
    const-string v0, "FinalRenderControllerICS"

    const-string v1, "Audio Track Found! "

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 351
    :catch_0
    move-exception v0

    .line 352
    const-string v1, "FinalRenderControllerICS"

    const-string v2, "Could not extract audio"

    invoke-static {v1, v2}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    .line 353
    new-instance v1, Ljava/lang/RuntimeException;

    invoke-direct {v1, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V

    throw v1

    .line 356
    :cond_3
    const-wide v0, 0x7fffffffffffffffL

    invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v0

    invoke-interface {v5, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 358
    invoke-interface {v5}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->x:Ljava/util/Iterator;

    .line 359
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->x:Ljava/util/Iterator;

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Long;

    invoke-virtual {v0}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    iput-wide v0, p0, Lcom/instagram/creation/video/h/d;->y:J

    .line 361
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/a;->f()I

    move-result v0

    mul-int/lit16 v0, v0, 0x3e8

    iput v0, p0, Lcom/instagram/creation/video/h/d;->A:I

    .line 362
    :goto_2
    iget-wide v0, p0, Lcom/instagram/creation/video/h/d;->y:J

    iget v2, p0, Lcom/instagram/creation/video/h/d;->A:I

    int-to-long v2, v2

    cmp-long v0, v0, v2

    if-gez v0, :cond_4

    .line 363
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->x:Ljava/util/Iterator;

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Long;

    invoke-virtual {v0}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    iput-wide v0, p0, Lcom/instagram/creation/video/h/d;->y:J

    .line 364
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->w:Ljava/util/Iterator;

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    goto :goto_2

    .line 367
    :cond_4
    const/4 v0, 0x2

    const v1, 0xbb80

    invoke-static {v0, v1}, Lcom/instagram/creation/video/jni/VideoBridge;->configureAACTrack(II)I

    .line 368
    return-void
.end method

.method private u()V
    .locals 4

    .prologue
    .line 371
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->B:Ljava/lang/Object;

    monitor-enter v1

    .line 372
    const/4 v0, 0x1

    :try_start_0
    iput-boolean v0, p0, Lcom/instagram/creation/video/h/d;->C:Z

    .line 374
    new-instance v0, Landroid/media/MediaPlayer;

    invoke-direct {v0}, Landroid/media/MediaPlayer;-><init>()V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 376
    :try_start_1
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    iget-object v2, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v2}, Lcom/instagram/pendingmedia/model/a;->b()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Landroid/media/MediaPlayer;->setDataSource(Ljava/lang/String;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    .line 380
    :try_start_2
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    const/4 v2, 0x0

    const/4 v3, 0x0

    invoke-virtual {v0, v2, v3}, Landroid/media/MediaPlayer;->setVolume(FF)V

    .line 381
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    new-instance v2, Landroid/view/Surface;

    iget-object v3, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    invoke-virtual {v3}, Lcom/instagram/creation/video/h/g;->d()Landroid/graphics/SurfaceTexture;

    move-result-object v3

    invoke-direct {v2, v3}, Landroid/view/Surface;-><init>(Landroid/graphics/SurfaceTexture;)V

    invoke-virtual {v0, v2}, Landroid/media/MediaPlayer;->setSurface(Landroid/view/Surface;)V

    .line 382
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0, p0}, Landroid/media/MediaPlayer;->setOnCompletionListener(Landroid/media/MediaPlayer$OnCompletionListener;)V

    .line 383
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0, p0}, Landroid/media/MediaPlayer;->setOnSeekCompleteListener(Landroid/media/MediaPlayer$OnSeekCompleteListener;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 386
    :try_start_3
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->prepare()V
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1

    .line 390
    :try_start_4
    monitor-exit v1
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0

    .line 392
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    invoke-virtual {v0}, Lcom/instagram/creation/video/h/g;->d()Landroid/graphics/SurfaceTexture;

    move-result-object v0

    invoke-virtual {v0, p0}, Landroid/graphics/SurfaceTexture;->setOnFrameAvailableListener(Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;)V

    .line 393
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/h/g;->b(Lcom/instagram/pendingmedia/model/a;)V

    .line 395
    const-string v0, "FinalRenderControllerICS"

    const-string v1, "Configured Video Player"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 396
    return-void

    .line 377
    :catch_0
    move-exception v0

    .line 378
    :try_start_5
    new-instance v2, Ljava/lang/IllegalStateException;

    const-string v3, "Could not create media player"

    invoke-direct {v2, v3, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v2

    .line 390
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0

    throw v0

    .line 387
    :catch_1
    move-exception v0

    .line 388
    :try_start_6
    new-instance v2, Ljava/lang/IllegalStateException;

    const-string v3, "Could not prepare player"

    invoke-direct {v2, v3, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v2
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_0
.end method

.method private v()V
    .locals 4

    .prologue
    const/16 v1, 0x1e0

    .line 399
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->b:Ljava/lang/String;

    invoke-static {v0, v1, v1}, Lcom/instagram/creation/video/jni/VideoBridge;->configureVideoCodec(Ljava/lang/String;II)I

    move-result v0

    .line 402
    const-string v1, "FinalRenderControllerICS"

    const-string v2, "Configuring video codec"

    invoke-static {v1, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 403
    if-eqz v0, :cond_0

    .line 404
    const-string v1, "FinalRenderControllerICS"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Could not configure codec: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v1, v0}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    .line 406
    :cond_0
    return-void
.end method


# virtual methods
.method public b()V
    .locals 5

    .prologue
    const/16 v4, 0x1e0

    const/4 v1, 0x0

    .line 121
    const-string v0, "FinalRenderControllerICS"

    const-string v2, "Starting Final Render"

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    move v0, v1

    .line 123
    :goto_0
    const/4 v2, 0x2

    if-ge v0, v2, :cond_0

    .line 124
    iget-object v2, p0, Lcom/instagram/creation/video/h/d;->f:Ljava/util/Queue;

    new-instance v3, Lcom/instagram/creation/video/gl/k;

    invoke-direct {v3, v4}, Lcom/instagram/creation/video/gl/k;-><init>(I)V

    invoke-interface {v2, v3}, Ljava/util/Queue;->offer(Ljava/lang/Object;)Z

    .line 123
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 126
    :cond_0
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v0

    sget-object v2, Lcom/instagram/creation/video/gl/q;->b:Lcom/instagram/creation/video/gl/q;

    invoke-virtual {v0, v2}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/q;)V

    .line 127
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/h/i;->c(I)V

    .line 129
    new-instance v0, Lcom/instagram/creation/video/gl/k;

    invoke-direct {v0, v4}, Lcom/instagram/creation/video/gl/k;-><init>(I)V

    iput-object v0, p0, Lcom/instagram/creation/video/h/d;->p:Lcom/instagram/creation/video/gl/k;

    .line 131
    invoke-direct {p0}, Lcom/instagram/creation/video/h/d;->t()V

    .line 132
    invoke-direct {p0}, Lcom/instagram/creation/video/h/d;->u()V

    .line 133
    invoke-direct {p0}, Lcom/instagram/creation/video/h/d;->v()V

    .line 140
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/a;->f()I

    move-result v0

    const/16 v1, 0xbb8

    if-le v0, v1, :cond_1

    .line 141
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v1}, Lcom/instagram/pendingmedia/model/a;->f()I

    move-result v1

    add-int/lit16 v1, v1, -0xbb8

    invoke-virtual {v0, v1}, Landroid/media/MediaPlayer;->seekTo(I)V

    .line 143
    :cond_1
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->q:Ljava/lang/Object;

    monitor-enter v1

    .line 144
    const/4 v0, 0x1

    :try_start_0
    iput-boolean v0, p0, Lcom/instagram/creation/video/h/d;->r:Z

    .line 145
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->q:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 146
    monitor-exit v1

    .line 147
    return-void

    .line 146
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public e()V
    .locals 8

    .prologue
    const/4 v5, 0x1

    const/4 v7, 0x0

    .line 207
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/h/i;->a(Lcom/instagram/creation/video/gl/a;)Z

    move-result v0

    if-eqz v0, :cond_3

    .line 208
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->l:Z

    if-eqz v0, :cond_1

    .line 209
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->k:Lcom/instagram/creation/video/h/b;

    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->f:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->poll()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/creation/video/gl/k;

    invoke-virtual {v1, v0}, Lcom/instagram/creation/video/h/b;->a(Lcom/instagram/creation/video/gl/k;)V

    .line 210
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->g:Ljava/util/Queue;

    iget v1, p0, Lcom/instagram/creation/video/h/d;->o:I

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/Queue;->offer(Ljava/lang/Object;)Z

    .line 211
    iget v0, p0, Lcom/instagram/creation/video/h/d;->t:I

    const/4 v1, -0x1

    if-eq v0, v1, :cond_0

    .line 212
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->h:Ljava/util/Queue;

    iget v1, p0, Lcom/instagram/creation/video/h/d;->t:I

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/Queue;->offer(Ljava/lang/Object;)Z

    .line 214
    :cond_0
    const-string v0, "FinalRenderControllerICS"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Enqueueing frame at time "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget v2, p0, Lcom/instagram/creation/video/h/d;->o:I

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " for "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget v2, p0, Lcom/instagram/creation/video/h/d;->t:I

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, " ms"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 215
    iput-boolean v7, p0, Lcom/instagram/creation/video/h/d;->l:Z

    .line 218
    :cond_1
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->v:Z

    if-eqz v0, :cond_2

    .line 219
    iput-boolean v7, p0, Lcom/instagram/creation/video/h/d;->v:Z

    .line 220
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v0

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->p:Lcom/instagram/creation/video/gl/k;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/k;)V

    .line 221
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v0

    sget-object v1, Lcom/instagram/creation/video/gl/q;->a:Lcom/instagram/creation/video/gl/q;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/q;)V

    .line 222
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    invoke-virtual {v0, v5}, Lcom/instagram/creation/video/h/i;->c(I)V

    .line 254
    :cond_2
    :goto_0
    return-void

    .line 225
    :cond_3
    iget v0, p0, Lcom/instagram/creation/video/h/d;->e:I

    add-int/lit8 v0, v0, 0x1

    iput v0, p0, Lcom/instagram/creation/video/h/d;->e:I

    .line 226
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->k:Lcom/instagram/creation/video/h/b;

    invoke-virtual {v0}, Lcom/instagram/creation/video/h/b;->c()Lcom/instagram/creation/video/gl/k;

    move-result-object v1

    .line 227
    const-string v0, "FinalRenderControllerICS"

    const-string v2, "Rendering frame number %d at time %d for %dms using buffer %d(%d)"

    const/4 v3, 0x5

    new-array v3, v3, [Ljava/lang/Object;

    iget v4, p0, Lcom/instagram/creation/video/h/d;->e:I

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    aput-object v4, v3, v7

    iget-object v4, p0, Lcom/instagram/creation/video/h/d;->g:Ljava/util/Queue;

    invoke-interface {v4}, Ljava/util/Queue;->peek()Ljava/lang/Object;

    move-result-object v4

    aput-object v4, v3, v5

    const/4 v4, 0x2

    iget-object v5, p0, Lcom/instagram/creation/video/h/d;->h:Ljava/util/Queue;

    invoke-interface {v5}, Ljava/util/Queue;->peek()Ljava/lang/Object;

    move-result-object v5

    aput-object v5, v3, v4

    const/4 v4, 0x3

    invoke-virtual {v1}, Lcom/instagram/creation/video/gl/k;->a()I

    move-result v5

    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    aput-object v5, v3, v4

    const/4 v4, 0x4

    invoke-virtual {v1}, Lcom/instagram/creation/video/gl/k;->b()I

    move-result v5

    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    aput-object v5, v3, v4

    invoke-static {v2, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 233
    iget-object v2, p0, Lcom/instagram/creation/video/h/d;->c:Lcom/instagram/pendingmedia/model/c;

    const-wide v3, 0x4046800000000000L

    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->g:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->peek()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Integer;

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    iget-object v5, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v5}, Lcom/instagram/pendingmedia/model/a;->f()I

    move-result v5

    sub-int/2addr v0, v5

    int-to-double v5, v0

    mul-double/2addr v3, v5

    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v0}, Lcom/instagram/pendingmedia/model/a;->h()I

    move-result v0

    int-to-double v5, v0

    div-double/2addr v3, v5

    double-to-int v0, v3

    invoke-virtual {v2, v0}, Lcom/instagram/pendingmedia/model/c;->c(I)V

    .line 235
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->g:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->peek()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Integer;

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    mul-int/lit16 v0, v0, 0x3e8

    int-to-long v2, v0

    invoke-direct {p0, v2, v3}, Lcom/instagram/creation/video/h/d;->a(J)V

    .line 236
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->g:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->poll()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Integer;

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    mul-int/lit16 v0, v0, 0x3e8

    iget v2, p0, Lcom/instagram/creation/video/h/d;->A:I

    sub-int/2addr v0, v2

    int-to-long v2, v0

    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->h:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->poll()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Integer;

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    mul-int/lit16 v0, v0, 0x3e8

    int-to-long v4, v0

    invoke-static {v2, v3, v4, v5}, Lcom/instagram/creation/video/jni/VideoBridge;->encodeFrame(JJ)I

    .line 238
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->f:Ljava/util/Queue;

    invoke-interface {v0, v1}, Ljava/util/Queue;->offer(Ljava/lang/Object;)Z

    .line 240
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->h:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_2

    .line 241
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->m:Z

    if-eqz v0, :cond_4

    .line 242
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->k()V

    .line 243
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->p()V

    .line 249
    :goto_1
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->u:Ljava/lang/Object;

    monitor-enter v1

    .line 250
    :try_start_0
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->u:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 251
    monitor-exit v1

    goto/16 :goto_0

    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0

    .line 245
    :cond_4
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v0

    sget-object v1, Lcom/instagram/creation/video/gl/q;->b:Lcom/instagram/creation/video/gl/q;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/q;)V

    .line 246
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    invoke-virtual {v0, v7}, Lcom/instagram/creation/video/h/i;->c(I)V

    .line 247
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    invoke-virtual {v0}, Lcom/instagram/creation/video/h/g;->e()V

    goto :goto_1
.end method

.method public f()V
    .locals 3

    .prologue
    .line 302
    invoke-static {}, Lcom/instagram/creation/video/jni/VideoBridge;->finishEncoding()I

    .line 304
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->B:Ljava/lang/Object;

    monitor-enter v1

    .line 305
    const/4 v0, 0x0

    :try_start_0
    iput-boolean v0, p0, Lcom/instagram/creation/video/h/d;->C:Z

    .line 307
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->stop()V

    .line 308
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->release()V

    .line 309
    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 311
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->q()Z

    move-result v0

    if-nez v0, :cond_0

    .line 312
    new-instance v0, Ljava/io/File;

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->b:Ljava/lang/String;

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    .line 313
    const-string v0, "FinalRenderControllerICS"

    const-string v1, "Cleaning up partially rendered files."

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 318
    :goto_0
    return-void

    .line 309
    :catchall_0
    move-exception v0

    :try_start_1
    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v0

    .line 315
    :cond_0
    const-string v0, "FinalRenderControllerICS"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Rendered to "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/instagram/creation/video/h/d;->b:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 316
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->c:Lcom/instagram/pendingmedia/model/c;

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->b:Ljava/lang/String;

    invoke-virtual {v0, v1}, Lcom/instagram/pendingmedia/model/c;->f(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public g()Z
    .locals 2

    .prologue
    .line 198
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/h/i;->a(Lcom/instagram/creation/video/gl/a;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 199
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v1

    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->f:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->peek()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/instagram/creation/video/gl/k;

    invoke-virtual {v1, v0}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/k;)V

    .line 202
    :cond_0
    const/4 v0, 0x0

    return v0
.end method

.method public j()V
    .locals 2

    .prologue
    .line 322
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->u:Ljava/lang/Object;

    monitor-enter v1

    .line 323
    :try_start_0
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->u:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 324
    monitor-exit v1

    .line 325
    return-void

    .line 324
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public onCompletion(Landroid/media/MediaPlayer;)V
    .locals 5
    .parameter "mp"

    .prologue
    const/4 v4, 0x1

    .line 410
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->m:Z

    if-eqz v0, :cond_0

    .line 432
    :goto_0
    return-void

    .line 413
    :cond_0
    iput-boolean v4, p0, Lcom/instagram/creation/video/h/d;->m:Z

    .line 415
    const-string v0, "FinalRenderControllerICS"

    const-string v1, "Video finished"

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 417
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->B:Ljava/lang/Object;

    monitor-enter v1

    .line 418
    :try_start_0
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->C:Z

    if-eqz v0, :cond_1

    .line 419
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->h:Ljava/util/Queue;

    iget-object v2, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v2}, Landroid/media/MediaPlayer;->getCurrentPosition()I

    move-result v2

    iget v3, p0, Lcom/instagram/creation/video/h/d;->n:I

    sub-int/2addr v2, v3

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-interface {v0, v2}, Ljava/util/Queue;->offer(Ljava/lang/Object;)Z

    .line 423
    :goto_1
    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    .line 425
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    invoke-virtual {v0, v4}, Lcom/instagram/creation/video/h/i;->c(I)V

    .line 426
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v0

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->p:Lcom/instagram/creation/video/gl/k;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/k;)V

    .line 427
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v0

    sget-object v1, Lcom/instagram/creation/video/gl/q;->a:Lcom/instagram/creation/video/gl/q;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/q;)V

    .line 429
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->u:Ljava/lang/Object;

    monitor-enter v1

    .line 430
    :try_start_1
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->u:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 431
    monitor-exit v1

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v0

    .line 421
    :cond_1
    :try_start_2
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->h:Ljava/util/Queue;

    const/16 v2, 0x2a

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-interface {v0, v2}, Ljava/util/Queue;->offer(Ljava/lang/Object;)Z

    goto :goto_1

    .line 423
    :catchall_1
    move-exception v0

    monitor-exit v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    throw v0
.end method

.method public onFrameAvailable(Landroid/graphics/SurfaceTexture;)V
    .locals 5
    .parameter "surfaceTexture"

    .prologue
    const/4 v4, 0x1

    .line 151
    const-string v1, "FinalRenderControllerICS"

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Frame Available! "

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    iget-object v3, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    invoke-virtual {v0, v3}, Lcom/instagram/creation/video/h/i;->a(Lcom/instagram/creation/video/gl/a;)Z

    move-result v0

    if-eqz v0, :cond_0

    const-string v0, "P"

    :goto_0
    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v1, v0}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 152
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->j:Lcom/instagram/creation/video/h/g;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/h/i;->a(Lcom/instagram/creation/video/gl/a;)Z

    move-result v0

    if-eqz v0, :cond_5

    .line 153
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->B:Ljava/lang/Object;

    monitor-enter v1

    .line 154
    :try_start_0
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->C:Z

    if-nez v0, :cond_1

    .line 155
    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 194
    :goto_1
    return-void

    .line 151
    :cond_0
    const-string v0, "C"

    goto :goto_0

    .line 157
    :cond_1
    :try_start_1
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->getCurrentPosition()I

    move-result v0

    iput v0, p0, Lcom/instagram/creation/video/h/d;->n:I

    .line 158
    const-string v0, "FinalRenderControllerICS"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    iget v3, p0, Lcom/instagram/creation/video/h/d;->o:I

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\t"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget v3, p0, Lcom/instagram/creation/video/h/d;->n:I

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 160
    iget v0, p0, Lcom/instagram/creation/video/h/d;->n:I

    iget-object v2, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v2}, Lcom/instagram/pendingmedia/model/a;->f()I

    move-result v2

    if-lt v0, v2, :cond_2

    .line 161
    iget v0, p0, Lcom/instagram/creation/video/h/d;->n:I

    iget-object v2, p0, Lcom/instagram/creation/video/h/d;->z:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v2}, Lcom/instagram/pendingmedia/model/a;->g()I

    move-result v2

    if-lt v0, v2, :cond_3

    .line 162
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->stop()V

    .line 164
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->h:Ljava/util/Queue;

    const/16 v2, 0x2a

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-interface {v0, v2}, Ljava/util/Queue;->offer(Ljava/lang/Object;)Z

    .line 165
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/instagram/creation/video/h/d;->v:Z

    .line 168
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/instagram/creation/video/h/d;->m:Z

    .line 187
    :cond_2
    :goto_2
    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 188
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->r()Lcom/instagram/creation/video/h/i;

    move-result-object v0

    invoke-virtual {v0, v4}, Lcom/instagram/creation/video/h/i;->a(Z)V

    .line 193
    :goto_3
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->m()V

    goto :goto_1

    .line 170
    :cond_3
    :try_start_2
    iget v0, p0, Lcom/instagram/creation/video/h/d;->n:I

    iget v2, p0, Lcom/instagram/creation/video/h/d;->o:I

    if-le v0, v2, :cond_2

    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->s:Z

    if-nez v0, :cond_2

    .line 171
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/instagram/creation/video/h/d;->l:Z

    .line 173
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->f:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->size()I

    move-result v0

    const/4 v2, 0x2

    if-eq v0, v2, :cond_4

    .line 174
    iget v0, p0, Lcom/instagram/creation/video/h/d;->n:I

    iget v2, p0, Lcom/instagram/creation/video/h/d;->o:I

    sub-int/2addr v0, v2

    iput v0, p0, Lcom/instagram/creation/video/h/d;->t:I

    .line 178
    :goto_4
    iget v0, p0, Lcom/instagram/creation/video/h/d;->n:I

    iput v0, p0, Lcom/instagram/creation/video/h/d;->o:I

    .line 180
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->f:Ljava/util/Queue;

    invoke-interface {v0}, Ljava/util/Queue;->size()I

    move-result v0

    if-ne v0, v4, :cond_2

    .line 181
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->pause()V

    .line 182
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/instagram/creation/video/h/d;->v:Z

    goto :goto_2

    .line 187
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    throw v0

    .line 176
    :cond_4
    const/4 v0, -0x1

    :try_start_3
    iput v0, p0, Lcom/instagram/creation/video/h/d;->t:I
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    goto :goto_4

    .line 190
    :cond_5
    iput-boolean v4, p0, Lcom/instagram/creation/video/h/d;->s:Z

    .line 191
    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->r()Lcom/instagram/creation/video/h/i;

    move-result-object v0

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/h/i;->a(Z)V

    goto :goto_3
.end method

.method public onSeekComplete(Landroid/media/MediaPlayer;)V
    .locals 3
    .parameter "mp"

    .prologue
    .line 436
    const-string v0, "FinalRenderControllerICS"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Seeked to "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {p1}, Landroid/media/MediaPlayer;->getCurrentPosition()I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ", requested "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget v2, p0, Lcom/instagram/creation/video/h/d;->o:I

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 437
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/instagram/creation/video/h/d;->s:Z

    .line 438
    invoke-virtual {p1}, Landroid/media/MediaPlayer;->start()V

    .line 439
    return-void
.end method

.method public r()Lcom/instagram/creation/video/h/i;
    .locals 1

    .prologue
    .line 116
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->i:Lcom/instagram/creation/video/h/i;

    return-object v0
.end method

.method public s()V
    .locals 3

    .prologue
    .line 265
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->q:Ljava/lang/Object;

    monitor-enter v1

    .line 266
    :try_start_0
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->r:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-nez v0, :cond_0

    .line 268
    :try_start_1
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->q:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->wait()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    .line 272
    :cond_0
    :goto_0
    :try_start_2
    monitor-exit v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 273
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->start()V

    .line 276
    :goto_1
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->u:Ljava/lang/Object;

    monitor-enter v1

    .line 278
    :try_start_3
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->u:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->wait()V
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_1
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_0

    .line 281
    :goto_2
    :try_start_4
    monitor-exit v1
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_1

    .line 283
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->m:Z

    if-nez v0, :cond_1

    invoke-virtual {p0}, Lcom/instagram/creation/video/h/d;->i()Z

    move-result v0

    if-eqz v0, :cond_2

    .line 298
    :cond_1
    return-void

    .line 272
    :catchall_0
    move-exception v0

    :try_start_5
    monitor-exit v1
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0

    throw v0

    .line 281
    :catchall_1
    move-exception v0

    :try_start_6
    monitor-exit v1
    :try_end_6
    .catchall {:try_start_6 .. :try_end_6} :catchall_1

    throw v0

    .line 287
    :cond_2
    iget-object v1, p0, Lcom/instagram/creation/video/h/d;->B:Ljava/lang/Object;

    monitor-enter v1

    .line 288
    :try_start_7
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->C:Z

    if-eqz v0, :cond_3

    .line 289
    iget-boolean v0, p0, Lcom/instagram/creation/video/h/d;->s:Z

    if-eqz v0, :cond_4

    .line 291
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    iget v2, p0, Lcom/instagram/creation/video/h/d;->o:I

    add-int/lit16 v2, v2, -0x5dc

    invoke-virtual {v0, v2}, Landroid/media/MediaPlayer;->seekTo(I)V

    .line 296
    :cond_3
    :goto_3
    monitor-exit v1

    goto :goto_1

    :catchall_2
    move-exception v0

    monitor-exit v1
    :try_end_7
    .catchall {:try_start_7 .. :try_end_7} :catchall_2

    throw v0

    .line 293
    :cond_4
    :try_start_8
    iget-object v0, p0, Lcom/instagram/creation/video/h/d;->d:Landroid/media/MediaPlayer;

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->start()V
    :try_end_8
    .catchall {:try_start_8 .. :try_end_8} :catchall_2

    goto :goto_3

    .line 279
    :catch_0
    move-exception v0

    goto :goto_2

    .line 269
    :catch_1
    move-exception v0

    goto :goto_0
.end method
